//
// Case.cpp for bomberman in /home/lefebv_w//workspace/cpp/bomberman/googleCode/v1
// 
// Made by damien lefebvre
// Login   <lefebv_w@epitech.net>
// 
// Started on  Fri May  3 19:04:43 2013 damien lefebvre
// Last update Wed May  8 14:51:48 2013 damien lefebvre
//

#include		"Case.hh"

Case::Case(bool empty, float x, float z, float size)
  :   AObject(), m_empty(empty), m_size(size)
{
  m_position.x = x;
  m_position.z = z;
  m_position.y = 0.f;
}

void		Case::initialize(void)
{}

void		Case::update(gdl::GameClock const & gameClock, gdl::Input & input)
{}

void		Case::draw(void)
{
  if (m_empty == true)
    glColor3f(0.75f, 0.50f, 1.0f);
  else
    glColor3f(1.0f, 0.50f, 0.50f);
 
  glBegin(GL_QUADS);
    
  // Face 1
  glVertex3f(m_position.x, m_position.y, m_position.z);
  glVertex3f(m_position.x + m_size, m_position.y, m_position.z);
  glVertex3f(m_position.x + m_size, m_position.y, m_position.z + m_size);
  glVertex3f(m_position.x, m_position.y, m_position.z + m_size);
  glVertex3f(m_position.x, m_position.y, m_position.z);
 
  glEnd();

  if (m_empty == false)
    {
      glColor3f(1.0f, 0.60f, 0.60f);
      glBegin(GL_QUADS);
    
      // Face 2
      glVertex3f(m_position.x, m_position.y, m_position.z);
      glVertex3f(m_position.x + m_size, m_position.y, m_position.z);
      glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z);
      glVertex3f(m_position.x, m_position.y + m_size, m_position.z);
      glVertex3f(m_position.x, m_position.y, m_position.z);
      
      glEnd();

      glColor3f(1.0f, 0.60f, 0.60f);
      glBegin(GL_QUADS);
    
      // Face 3
      glVertex3f(m_position.x + m_size, m_position.y, m_position.z);
      glVertex3f(m_position.x + m_size, m_position.y, m_position.z + m_size);
      glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z + m_size);
      glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z);
      glVertex3f(m_position.x + m_size, m_position.y, m_position.z);
      
      glEnd();
      
      glColor3f(1.0f, 0.70f, 0.70f);
      glBegin(GL_QUADS);
    
      // Face 4
      glVertex3f(m_position.x + m_size, m_position.y, m_position.z + m_size);
      glVertex3f(m_position.x, m_position.y, m_position.z + m_size);
      glVertex3f(m_position.x, m_position.y + m_size, m_position.z + m_size);
      glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z + m_size);
      glVertex3f(m_position.x + m_size, m_position.y, m_position.z + m_size);
      
      glEnd();
    
      glColor3f(1.0f, 0.80f, 0.80f);
      glBegin(GL_QUADS);
    
      // Face 5
      glVertex3f(m_position.x, m_position.y, m_position.z);
      glVertex3f(m_position.x, m_position.y, m_position.z + m_size);
      glVertex3f(m_position.x, m_position.y + m_size, m_position.z + m_size);
      glVertex3f(m_position.x, m_position.y + m_size, m_position.z);
      glVertex3f(m_position.x, m_position.y, m_position.z);
      
      glEnd();

      glColor3f(1.0f, 0.90f, 0.90f);
      glBegin(GL_QUADS);
    
      // Face 6
      glVertex3f(m_position.x, m_position.y + m_size, m_position.z);
      glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z);
      glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z + m_size);
      glVertex3f(m_position.x, m_position.y + m_size, m_position.z + m_size);
      glVertex3f(m_position.x, m_position.y + m_size, m_position.z);
      
      glEnd();

      
      // // Face 2, 3, 4 & 5
      // glVertex3f(m_position.x, m_position.y + m_size, m_position.z);
      // glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z);
      // glVertex3f(m_position.x + m_size, m_position.y, m_position.z);
      // glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z);
      
      // glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z + m_size);
      // glVertex3f(m_position.x + m_size, m_position.y, m_position.z + m_size);
      // glVertex3f(m_position.x + m_size, m_position.y + m_size, m_position.z + m_size);
 
      // glVertex3f(m_position.x, m_position.y + m_size, m_position.z + m_size);
      // glVertex3f(m_position.x, m_position.y, m_position.z + m_size);
      // glVertex3f(m_position.x, m_position.y + m_size, m_position.z + m_size);
      // glVertex3f(m_position.x, m_position.y + m_size, m_position.z);
    }
}
